from django.conf.urls import url
from api.views import login, message, credential, news, comment, favor, tasks, auction, bid, pay, order
from api.web import aucion as web_auction

urlpatterns = [
    url(r'login/$', login.LoginView.as_view()),
    url(r'message/$', message.MessageView.as_view()),
    url(r'credential/$', credential.CredentialView.as_view()),

    url(r'news/$', news.NewsView.as_view()),
    url(r'news/(?P<pk>\d+)/$', news.NewsDetailView.as_view()),

    url(r'comment/', comment.CommentView.as_view()),
    url(r'comment_favor/', favor.ChildFavorView.as_view()),
    url(r'favor/', favor.FavorView.as_view()),

    url(r'auction/$', auction.AuctionView.as_view()),
    url(r'auction/(?P<pk>\d+)/$', auction.AuctionDetailView.as_view()),
    url(r'auction/item/(?P<pk>\d+)/$', auction.AuctionItemDetailView.as_view()),
    url(r'auction/deposit/(?P<pk>\d+)/$', auction.AuctionDepositView.as_view()),
    url(r'auction/item/img/(?P<pk>\d+)/$', auction.AuctionItemImgae.as_view()),

    url(r'bid/$', bid.BidView.as_view()),
    url(r'pay/deposit/$', pay.PayDepositView.as_view()),
    url(r'pay/(?P<pk>\d+)/$', pay.PayDetailView.as_view()),
    url(r'pay/now/$', pay.PayNowView.as_view()),

    url(r'topic/$', auction.TopicView.as_view()),

    url(r'crate/task/$', tasks.create_task),
    url(r'get/task/$', tasks.get_result),

    url(r'order/$', order.OrderView.as_view()),
    url(r'user/coupon/$', order.UserCouponView.as_view()),
    url(r'coupon/$', order.CouponView.as_view()),
    url(r'coupon/(?P<pk>\d+)/$', order.CouponView.as_view()),
    url(r'coupon/delete/(?P<pk>\d+)/$', order.CouponDelete),
    # 第二种修改优惠卷
    # url(r'coupon/edit/(?P<pk>\d+)/$', order.CouponEditView.as_view()),
    # 第一种修改优惠卷
    url(r'coupon/edit/(?P<pk>\d+)/$', order.CouponEdit),

    # 后台处理
    url(r'auction/delete/$', web_auction.AuctionDeleteView.as_view()),
    url(r'auction/add/$', web_auction.AuctionAdd),
    url(r'auction/add/(?P<pk>\d+)/$', web_auction.AuctionItemAdd),
    url(r'auction/delete/(?P<pk>\d+)$', web_auction.AuctionItemDeleteView),
    url(r'auction/item/delete/(?P<pk>\d+)$', web_auction.AuctionItemImgDelete),
    url(r'auction/item/detail/$', web_auction.AuctionItemDetail),

    url(r'^address/$', order.AddressView.as_view()),
]
